from re import M


class MyList:
    def __init__(self, data) -> None:
        self.wrapped = list(data)

    def __add__(self, other):
        return MyList(self.wrapped+other)

    __radd__ = __add__

    def __mul__(self, time):
        return MyList(self.wrapped * time)

    def __getitem__(self, i):
        return self.wrapped[i]

    def __iter__(self):
        for x in self.wrapped:
            yield x

    def __len__(self):
        return len(self.wrapped)

    def append(self, x):
        return self.wrapped.append(x)

    def sort(self):
        return self.wrapped.sort()

    def __repr__(self):
        return repr(self.wrapped)


if __name__ == '__main__':
    x = MyList(['w', 'a', 'l'])
    print(x)
    print(x[2])
    print(x[1:])
    print(x+['eggs'])
    print(x*3)
    x.append('a')
    x.sort()
    print(' '.join(e for e in x))
    y = MyList(['z', 'h', 'a'])
    print(x+y)
